home *** CD-ROM | disk | FTP | other *** search
- public class WalkCycle extends Codex {
- private int actorGuid;
- private CodexActor actor;
- private int numFrames;
- private int currentFrame;
- private int goalFrame;
- private float[] pos = new float[3];
- private float speed = 90.0F;
-
- public void beginscene(int clientGuid, int captureID) {
- this.currentFrame = 0;
- this.goalFrame = 1;
- if (this.Init()) {
- ((Codex)this).SetTimer(5.0F);
- }
-
- }
-
- public void arrived(int thingGuid, int frameNum, int captureID) {
- this.currentFrame = this.goalFrame;
- if (++this.goalFrame >= this.numFrames) {
- this.goalFrame = 0;
- }
-
- this.pos = this.actor.GetFramePosition(this.goalFrame);
- this.actor.SendActorToPos(this.pos, 90.0F);
- }
-
- public void restore(int flags) {
- this.goalFrame = CodexSequence.RestoreInt();
- this.currentFrame = CodexSequence.RestoreInt();
- }
-
- public void restored(int flags) {
- ((Codex)this).KillTimer();
- if (this.Init()) {
- this.actor.SendActorToPos(this.pos, 90.0F);
- }
-
- }
-
- public void save(int flags) {
- CodexSequence.SaveInt(this.goalFrame);
- CodexSequence.SaveInt(this.currentFrame);
- }
-
- public void timer(int timerID, float arg0, float arg1, float arg2, float arg3) {
- this.actor.SendActorToPos(this.pos, 90.0F);
- }
-
- public boolean Init() {
- this.actorGuid = ((Codex)this).GetClassThing();
- if (!Codex.IsActorGuid(this.actorGuid)) {
- CodexConsole.PrintError("No class thing in WalkCycle!");
- return false;
- } else {
- this.actor = new CodexActor(this.actorGuid);
- this.numFrames = this.actor.GetNumFrames();
- if (this.numFrames == 0) {
- CodexConsole.PrintError("Object w/o frames in WalkCycle!");
- return false;
- } else {
- this.pos = this.actor.GetFramePosition(this.goalFrame);
- this.actor.SetActorFlags(524288);
- return true;
- }
- }
- }
- }
-